#!/usr/bin/env python3
'''将datain多个数据文件打开,合并到一个新文件中并保存到dataout目录'''
import os
import sys
import glob
import csv

dir_in=sys.argv[1]
dir_out=sys.argv[2]
allinputlines=[]
allfiles=glob.glob(os.path.join(dir_in,'in*.csv'))
outputpath=dir_out+"/"+r'outtoltal.csv'
for inputfile in allfiles:
	with open(inputfile,'r',newline='') as filereader:
		for oneline in filereader: 
			onele = oneline.strip()
			allinputlines.append(onele)
with open(outputpath,'w',newline='') as outputfile:
	for oneline in allinputlines:
		outputfile.write(oneline+'\n')	


